package com.example.demo.study;

import java.util.concurrent.TimeUnit;

public class OtherTest {
    public static void main(String[] args) throws InterruptedException {
        long total = Runtime.getRuntime().totalMemory() / 1024 / 1024;
        long max = Runtime.getRuntime().maxMemory() / 1024 / 1024;
        long free = Runtime.getRuntime().freeMemory() / 1024 / 1024;
        TimeUnit.SECONDS.sleep(3);
        System.out.println("total=" + total + "(MB)");
        System.out.println("max=" + max + "(MB)");
        System.out.println("free=" + free + "(MB)");
        System.out.println("--------");
        System.out.println(total * 64.0 / 1024);
        System.out.println(max * 4.0 / 1024);
    }
}
